#include "Music.h"

//索引与频率对照表
unsigned int code FreqTable[]={
	0,
	63628,63731,63835,63928,64021,64103,64185,64260,64331,64400,64463,64528,
	64580,64633,64684,64732,64777,64820,64860,64898,64934,64968,65000,65030,
	65058,65085,65110,65134,65157,65178,65198,65217,65235,65252,65268,65283,
};

unsigned char code Music_HuaHai[]={
	//花海---周杰伦
	//音符,时值,	
	//1行号
	P,	4,	M1,	4,	M2,	4,	M3,	4,	M5,	4,	M5,	4+2,	M3,	4,	M2,	4,	M1,	4,	M2,	4,	M3,	4,	P,	4,	
	//2行号
	M1,	4,	M2,	4,	M3,	4,	M7,	4,	H1,	4,	H1,	4,	M7,	4,	M6,	4,	M5,	4,	M6,	4,	M5,	4,	P,	4,	
	//3行号
	M1,	4,	M2,	4,	M3,	4,	M5,	4,	M5,	4+2,	M3,	4,	M2,	4,	M1,	4,	M2,	4,	M1,	4,	P,	4,	
	//4行号
	M1,	4,	M2,	4,	M3,	4,	M5,	4,	M5,	4+2,	M4,	4,	M4,	4,	M3,	4,	H1,	4,	M3,	4,	M2,	4,	P,	4,
	//最后一行
	M1,	4,	M2,	4,	M3,	4,	M5,	4,	M1,	4,	M1,	4+2,	L7, 4,	L6, 4,	L7, 4,	M1,	4,
	0xFF
};

unsigned char code Music_Castle_in_the_Sky[]={
	//《天空之城》
	//音符,时值,	
	//1行号
	P,	4,	P,	4,	P,	4,	M6,	2,	M7,	2,	//每一小节 时值都是16	
	H1,	4+2,	M7,	2,	H1,	4,	H3,	4,	M7,	4+4+4,	M3,	2,	M3,	2,
	//2
	M6,	4+2,	M5,	2,	M6, 4,	H1,	4,	
	M5,	4+4+4,	M3,	4,	
	M4,	4+2,	M3,	2,	M4,	4,	H1,	4,	
	//3
	M3,	4+4,	P,	2,	H1,	2,	H1,	2,	H1,	2,	
	M7,	4+2,	M4_,2,	M4_,4,	M7,	4,	
	M7,	8,	P,	4,	M6,	2,	M7,	2,	
	//4
	H1,	4+2,	M7,	2,	H1,	4,	H3,	4,	
	M7,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 1, M4, 1, 			M4, 2, M4, 2, M4, 2, 			M2, 2,  M2,  2,  P , 2, M6, 1,  M6, 1, M5, 2, M5, 2, M4, 2, M5, 4, P , 4,
	M3, 2, M3, 2, M3, 2, M3, 2, 	M3, 2, M5, 2, M5, 2, M5, 2,		M5, 2, M4, 2,  M4, 2, M3, 2,  M4, 2, P , 4,
	M2, 2, M2, 2, M2, 2, M2, 2,		M2, 2, M3, 2, M4, 2, M4, 2, 	M4, 2, M3, 2, M3, 2, M4, 2, 	M5, 2, P, 2, M6, 2, M5, 2, 
	M6, 4, M1, 2, M1, 2, 			M1, 2, M6, 2, P,  2, M6, 2,     M5, 2, M5, 2, M5, 2, M6, 2,  	
	M5, 5, P,  2, M4, 2, 			M4, 2, M4, 2, M4, 2, M4, 2, 	M2, 2, M1, 2, M2, 2, M1, 1, 	M1, 1, P,4,
	0xFF
};



/*
//Auld Lang Syne - 友谊天长地久 乐谱内容
0 0 0 5 | 1 . 1 1 3 | 2 . 1 2 3 2 | 1 . 1 3 5 | 6 -- 6 |
5 . 3 3 1 | 2 . 1 2 3 2 | 1 . 6 6 5 | 1 -- 6 | 5 . 3 3 1 | 2 . 1 2 6 |
5 . 3 3 5 | 6 -- 1 | 5 . 3 3 1 | 2 . 1 2 3 | 1 . 6 6 5 | 1 -- -- |
*/
unsigned char code Auld_Lang_Syne[] ={
    //Auld Lang Syne《友谊地久天长》
    // 音符, 时值,
    // 《友谊地久天长》
    // 音符, 时值,
    P, 4, P, 4, P, 4, H5, 4,       // 0 0 0 5
    M1, 6, L1, 4, M1, 4, M3, 4,   // 1 . 1 1 3
    M2, 6, L1, 4, M2, 4, L3, 2, L2, 2,  // 2 . 1 2 3 2
    M1, 6, L1, 4, M3, 4, M5, 4,   // 1 . 1 3 5
    M6, 8, M6, 4,                 // 6 -- 6
    
    M5, 6, L3, 4, M3, 4, M1, 4,   // 5 . 3 3 1
    M2, 6, L1, 4, M2, 4, L3, 2, L2, 2,  // 2 . 1 2 3 2
    M1, 6, H6, 4, H6, 4, H5, 4,   // 1 . 6 6 5
    M1, 4*3, M6, 4,                 // 1 -- 6
    M5, 6, L3, 4, M3, 4, M1, 4,   // 5 . 3 3 1
    M2, 6, L1, 4, M2, 4, M6, 4,   // 2 . 1 2 6
    
    M5, 6, L3, 4, M3, 4, M5, 4,   // 5 . 3 3 5
    M6, 8, M1, 4,                 // 6 -- 1
    M5, 6, L3, 4, M3, 4, M1, 4,   // 5 . 3 3 1
    M2, 6, L1, 4, M2, 4, M3, 4,   // 2 . 1 2 3
    M1, 6, L6, 4, L6, 4, M5, 4,   // 1 . 6 6 5
    M1, 8, M1, 8,                 // 1 -- --
    
    0xFF
};




//unsigned char code Music_lbkch[] = {
//    // 《离别开出花》
//    // 音符, 时值,
//    // 1 行号
//    P, 4, M1, 4, M1, 4, M2, 4, M3, 4, M1, 4, M2, 4, L6, 8, P, 4, M1, 4, M1, 4, M2, 4, M3, 4, M1, 4, M2, 4, M7, 8,
//    P, 4, M1, 4, M1, 4, M2, 4, M3, 4, M1, 4, M2, 4, L6, 8, M1, 4, M1, 4, M2, 4, M3, 4, M1, 4, M7, 4, M1, 4, M2, 4, M2, 4, M3, 4, M2, 4, M1, 4,
//    L6, 4, M3, 4, M2, 4, M1, 4, L6, 4, M1, 4, M2, 4, M2, 4, M3, 4, M2, 4, M1, 4, L6, 4, M1, 4, M2, 4, M2, 4, M2, 4, M3, 4, M4, 4,
//    L6, 4, M3, 4, M2, 4, M1, 4, L6, 4, M1, 4, M2, 4, M2, 4, M2, 4, M3, 4, M4, 4, M5, 4, M5, 4, M5, 4, M6, 4, M3, 4, M2, 4, M2, 4, M3, 4, M5, 4, M5, 4,
//    L6, 4, L6, 4, L6, 4, L6, 4, M5, 4, L6, 4, L6, 4, M1, 4, M1, 4, M1, 4, M1, 4, M7, 4, L6, 4, M7, 4, M3, 4, M3, 4, M3, 4, M5, 4, M3, 4, M2, 4, M2, 4, M3, 4, M5, 4, M5, 4,
//    L6, 4, L6, 4, L6, 4, L6, 4, M5, 4, L6, 4, L6, 4, M1, 4, M1, 4, M1, 4, M1, 4, M7, 4, L6, 4, M7, 4, L6, 4, M5, 4, M5, 4, M5, 4, M6, 4, M5, 4, M5, 4, M5, 4, M3, 4, M3, 4, M5, 4, M5, 4,
//    L6, 4, L6, 4, M5, 4, L6, 4, M5, 4, L6, 4, L6, 4, M1, 4, M1, 4, M1, 4, M7, 4, L6, 4, M7, 4, L6, 4, M5, 4, M5, 4, M5, 4, M3, 4, M5, 4, M5, 4, P, 8, P, 8
//};



/* 成都
1 -- | 0 0 5 | 1 -- | 1 - 2 3 | 5 3 3 | 3 - 5 | 1 -- | 2 1 6 |
5 -- | 5 - 5 | 1 -- | 1 - 2 3 | 6 3 5 | 5 3 2 | 1 -- | 2 - 5 |
2 3 2 - | 2 - 3 | 5 -- | 5 3 5 | 6 1 6 | 6 - 3 | 2 - 1 | 2 - 3 |
3 -- | 3 - 5 | 5 -- | 0 3 3 | 2 1 1 | 1 - 5 | 2 - 1 | 3 - 2 1 |
1 -- | 1 -- | 1 -- | 0 0 5 | 1 -- | 1 - 2 3 | 5 3 3 | 3 - 5 |
1 - 1 | 2 1 6 | 5 -- | 5 - 5 | 1 -- | 1 - 2 3 | 6 3 5 | 5 3 2 |
1 -- | 2 - 5 | 3 2 - | 2 - 3 | 5 - 5 | 5 3 5 | 6 - 1 | 6 - 3 |
2 - 1 | 2 - 5 | 3 -- | 3 - 3 | 5 -- | 0 0 3 2 | 6 1 - | 1 - 2 |
1 -- | 1 -- | 1 -- | 0 0 3 | 5 - 5 | 5 3 5 | 6 - 6 | 3 - 2 |
*/
unsigned char code Music_chengdu[] = {
    // 《晴天》
    // 音符, 时值,
    // 1 行号
    P, 4, P, 4, L5, 4, L1, 8, L1, 8, L2, 4, L3, 4, L3, 4, L3, 8, L1, 8, L2, 4, L5, 4,
    L5, 8, L5, 8, L1, 8, L2, 4, L6, 4, L3, 4, L5, 4, L3, 4, L2, 8, L1, 8, L2, 4, L5, 4,
    L2, 8, L3, 8, L2, 4, L3, 4, L5, 8, L5, 8, L5, 4, L3, 4, L5, 4, L6, 4, L1, 4, L6, 4, L3, 4, L2, 4, L1, 4,
    L3, 8, L3, 8, L5, 8, L5, 8, P, 4, L3, 4, L2, 4, L1, 4, L1, 8, L2, 8, L1, 8, L5, 4, L3, 4, L3, 4, L3, 8,
    L1, 8, L1, 8, L1, 8, P, 4, P, 4, L5, 4, L1, 8, L1, 8, L2, 4, L3, 4, L3, 4, L3, 8, L1, 8, L2, 4, L5, 4,
    L1, 4, L2, 4, L1, 4, L6, 8, L5, 8, L5, 8, L1, 8, L2, 4, L6, 4, L3, 4, L5, 4, L3, 4, L2, 8, L1, 8, L2, 4, L5, 4,
    L1, 8, L2, 4, L3, 8, L2, 4, L3, 4, L5, 8, L5, 8, L5, 4, L3, 4, L5, 4, L6, 4, L1, 4, L6, 4, L3, 4, L2, 4, L1, 4,
    L2, 4, L1, 4, L2, 8, L3, 8, L3, 8, L3, 8, L5, 8, P, 4, P, 4, L3, 4, L2, 4, L1, 4, L1, 8, L2, 8, L1, 8, L5, 4, L3, 4, L3, 4, L3, 8,
    L1, 8, L1, 8, L1, 8, P, 4, P, 4, L5, 4, L1, 8, L1, 8, L2, 4, L3, 4, L3, 4, L3, 8, L1, 8, L2, 4, L5, 4,
    L1, 4, L2, 4, L1, 4, L6, 8, L5, 8, L5, 8, L1, 8, L2, 4, L6, 4, L3, 4, L5, 4, L3, 4, L2, 8, L1, 8, L2, 4, L5, 4,
    L1, 8, L2, 4, L3, 8, L2, 4, L3, 4, L5, 8, L5, 8, L5, 4, L3, 4, L5, 4, L6, 4, L1, 4, L6, 4, L3, 4, L2, 4, L1, 4
};

unsigned char code Music_xiaoxingxing[]={
	13,4,
	13,4,
	20,4,
	20,4,
	22,4,
	22,4,
	20,4+4,
	0,4,
	18,4,
	18,4,
	17,4,
	17,4,
	15,4,
	15,4,
	13,4+4,
    
    P, 4, P, 4,

	13,4,
	13,4,
	20,4,
	20,4,
	22,4,
	22,4,
	20,4+4,
	0,4,
	18,4,
	18,4,
	17,4,
	17,4,
	15,4,
	15,4,
	13,4+4,
	
	0xFF
};
